<!-- imports -->
<%@page import="www.nomina.controller.beans.departamentoBean"%>
<%@page import="www.nomina.controller.beans.turnoBean"%>
<%@page import="www.nomina.controller.beans.puestoBean"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.sql.Date"%>
<%@page import="www.nomina.controller.beans.usuarioBean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page language="java"%>
<%
	if (request.getSession().getAttribute("sesion") == null) {
		request.getSession().setAttribute("error", 1);
		response.sendRedirect("CLOSE");
	} else {
		usuarioBean usuario = (usuarioBean) request.getSession()
				.getAttribute("sesion");
		ArrayList<puestoBean> puestos = (ArrayList) request
				.getAttribute("cat_puestos");
		ArrayList<turnoBean> turnos = (ArrayList) request
				.getAttribute("cat_turnos");
		ArrayList<departamentoBean> deptos = (ArrayList) request
				.getAttribute("cat_depto");
%>
<!DOCTYPE>
<html>
<head>
<title>SISTEMA DE NOMINAS</title>
<!-- Metadatos-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="">

<!-- Main Stylesheet -->
<link rel="stylesheet" type="text/css" href="CSS/lungo.css">
<link rel="stylesheet" type="text/css" href="CSS/lungo.theme.css">
<link rel="stylesheet" type="text/css" href="CSS/lungo.icon.css">

</head>

<body>

	<!-- Menu -->
	<%@ include file='../menu.jsp'%>
	<section id="splash" data-transition="slide" class="show">
		<article class="active splash">
			<img src="http://cdn.tapquo.com/lungo/logo.png" class="logo">
			<div class="form">
			<fieldset>
				
					<table>
						<tr>
						<th>
						<%
							String msjError = (String) request.getAttribute("mensaje");
								if (msjError != null) {
						%>
						<h3><%=msjError%></h3> <%
 								}
						 %>
						</th>
					</tr>
					</table>
				
				</fieldset>
				<form action='empresaSVR' method='post'>
					<input type='hidden' name='dispatch' value='6' />

					<fieldset class="radius-top" data-icon="edit">
						<span class="icon edit"></span><input type="text"
							name="rfc_empleado" placeholder="RFC EMPLEADO"
							required="required" onfocus="onfocus" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span> <input type="text" name="nombre"
							placeholder="NOMBRE" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text" name="paterno"
							placeholder="PATERNO" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span> <input type="text" name="materno"
							placeholder="MATERNO" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text" name="curp"
							placeholder="CURP" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span> <input type="text" name="imss"
							placeholder="IMSS" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="email" name="correo"
							placeholder="CORREO" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span> <input type="text" name="colonia"
							placeholder="COLONIA" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text" name="calle"
							placeholder="CALLE" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span> <input type="text" name="numero"
							placeholder="NUMERO" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text" name="cp"
							placeholder="CODIGO POSTAL" required="required"
							autocomplete="off" pattern="[0-9]{5}" maxlength="5">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text" name="estado"
							placeholder="ESTADO" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span> <input type="tel" name="tel1"
							placeholder="TELEFONO 1" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="tel"
							name="tel2" placeholder="TELEFONO 2" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span>
						<select class="custom" name="genero">
							<option>Elige Genero</option>
							<option value="femenino">FEMENINO</option>
							<option value="masculino">MASCULINO</option>
						</select>
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit">FECHA INGRESO</span><input type="date"
							name="fecha_ingreso"
							required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit">FECHA INICIAL DE PAGO</span>
						<input type="date" name="fecha_inicial_pago"	required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit">FECHA FINAL DE PAGO</span>
						<input type="date"
							name="fecha_final_pago" placeholder="ANTIGUEDAD" required="required"
							autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit">FECHA DE PAGO</span><input type="date"
							name="fecha_pago" placeholder="ANTIGUEDAD" required="required"
							autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text"
							name="tipo_contrato" placeholder="TIPO DE CONTRATO"
							required="required" autocomplete="off">
					</fieldset>					
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text" name="salario" id="salario"
							placeholder="SALARIO" required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span>
						<script type="text/javascript">
						function changeFunc() {
						    var selectBox = document.getElementById("pago");
						    var selectedValue = selectBox.options[selectBox.selectedIndex].value;
						    var salario = document.getElementById("salario").value;
						    if(selectedValue == "semanal"){
						    	document.getElementById("salario_base").value = salario*7;
						    }else if(selectedValue == "quincenal"){
						    	document.getElementById("salario_base").value = salario*15;
						    }else if(selectedValue == "catorcenal"){
						    	document.getElementById("salario_base").value = salario*14;
						    }else if(selectedValue == "mensual"){
						    	document.getElementById("salario_base").value = salario*30;
						    }
						   }
						</script>
						<select id="pago" class="custom" name="forma_pago" onchange="changeFunc();">
							<option>Elige forma de pago</option>
							<option value="semanal">SEMANAL</option>
							<option value="quincenal">QUINCENAL</option>
							<option value="catorcenal">CATORCENAL</option>
							<option value="mensual">MENSUAL</option>
						</select>
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span><input type="text" id="salario_base"
							name="salario_base" placeholder="SALARIO BASE"
							required="required" autocomplete="off">
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span>
						<select class="custom" name="depto">
						<option>Elige departamento</option>
							<%
				for (departamentoBean bean : deptos) {
						out.println("<option value='"+bean.getDepartamento()+"'>"+bean.getDepartamento()+"");
					}
			%>
						</select>
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span>
						<select class="custom" name="puesto">
							<option>Elige puesto</option>
							<%
				for (puestoBean bean : puestos) {
						out.println("<option value='"+bean.getPuesto()+"'>"+bean.getPuesto()+"");
					}
			%>
						</select>
					</fieldset>
					<fieldset data-icon="edit">
						<span class="icon edit"></span>
						<select class="custom" name="turno">
							<option>Elige turno</option>
							<%
				for (turnoBean bean : turnos) {
						out.println("<option value='"+bean.getTurno()+"'>"+bean.getTurno()+"");
					}
			%>
						</select>
					</fieldset>
					<input type="submit" value="ENVIAR">
				</form>
				<button class="anchor"
					onclick="document.getElementById('cat_empleados').submit();">
					<abbr>CATALOGO</abbr>
				</button>
				<button class="anchor cancel" data-icon="lock"
					onclick="document.getElementById('configuracion').submit();">
					<span class="icon arrow-left"></span><abbr>VOLVER</abbr>
				</button>
				<span><small>Copyright (C) 2014 - </small><span
					class="text bold">Nominas</span></span>
			</div>
		</article>
	</section>
</body>
</html>
<%
	}
%>